/* Author:

*/
$(document).ready(function() {
    // Accordion
    $( "#accordion" ).accordion({
                       header: "h3",
             active: false,
                       collapsible: true,
                       heightStyle: "content"
    });
    // Autocomplete
    $( "#autocomplete" ).autocomplete({
          source: "includes/autocompletar.php",
          minLength: 2,//search after two characters
          select : function(event,ui){
                   window.location.href = ui.item.url;
                }
    });
    $.ui.autocomplete.prototype._renderItem = function( ul, item){
    var term = this.term.split(' ').join('|');
    var re = new RegExp("(" + term + ")", "gi") ;
    var t = item.label.replace(re,"<b>$1</b>");
    return $( "<li></li>" )
       .data( "item.autocomplete", item )
       .append( "<a>" + t + "</a>" )
       .appendTo( ul );
    };
    $('.description_active').click(function(){
          $(this).removeClass('description_active').val('');
    });
    // Logo parade
    $("#logoParade").smoothDivScroll({
      autoScrollingMode: "always",
      autoScrollingDirection: "endlessLoopRight",
      autoScrollingStep: 1,
      autoScrollingInterval: 25
    });
    // Logo parade event handlers
    $("#logoParade").bind("mouseover", function() {
      $(this).smoothDivScroll("stopAutoScrolling");
    }).bind("mouseout", function() {
      $(this).smoothDivScroll("startAutoScrolling");
    });
});




